package com.qf.tomcat;

import java.io.IOException;
import java.net.Socket;

public class RequestRunnable implements Runnable {

    private Socket socket;
    private HttpRequestAndResponse httpRequestAndResponse;

    public RequestRunnable(Socket socket,HttpRequestAndResponse httpRequestAndResponse){
        this.socket =socket;
        this.httpRequestAndResponse =httpRequestAndResponse;
    }


    public void run() {
        System.out.println(">>"+Thread.currentThread().getName()+":"+socket);
        try {
            httpRequestAndResponse.httpAccepted(socket);
            httpRequestAndResponse.request(socket);
            httpRequestAndResponse.response(socket);
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
